package cn.da.shuai.cool.mq.mqtt.config;

import lombok.Getter;
import lombok.Setter;
import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

@Getter
@Setter
@Configuration
@ConfigurationProperties(prefix = "mqtt")
public class MqttProperties {
    private String host;
    private String topic;
    private String clientId;
    private MqttConnectOptions options;

    public MqttConnectOptions getFinalOptions() {
        options.setServerURIs(new String[] {this.getHost()});
        return options;
    }
}
